export const watemark = (el, binding) => {
  // 1. 创建一个 canvas
  const canvas = document.createElement("canvas");
  // 2. 给 canvas 设置一些宽高
  canvas.width = 100;
  canvas.height = 100;
  canvas.style.border = "1px solid yellow";
  // 3. 将其添加到页面
  document.body.append(canvas);
  // 4. 获取 canvas 的 2b 铅笔
  const ctx = canvas.getContext("2d");
  // 5. 设置 ctx 的杨色，字体，旋转
  ctx.font = "30px 宋体";
  ctx.fillStyle = "red";
  ctx.translate(50, 50);
  ctx.rotate(-45);
  // 6. 画文字
  ctx.fillText(binding.value, -20, 0);
  // 7. 设置el的背景
  const base64 = canvas.toDataURL();
  console.log("base64", base64);
  el.style.background = `url(${base64}) repeat`;
  // 8. 记得把 canvas 给移除
  canvas.remove();
};
